using LANLauncher.Properties;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Resources;
using System.Windows.Forms;

namespace LANLauncher
{
	public class Options : Form
	{
		private IContainer components;

		private TextBox commandlineTextbox;

		private Button okButton;

		private Button cancelButton;

		private Label afLabel;

		private Label aaLabel;

		private Label resolutionLabel;

		private ComboBox lightingComboBox;

		private ComboBox shadowComboBox;

		private ComboBox textureComboBox;

		private ComboBox afComboBox;

		private ComboBox aaComboBox;

		private ComboBox resolutionComboBox;

		private Label lightingLabel;

		private Label shadowLabel;

		private Label textureLabel;

		private Label ssaoLabel;

		private Label noteLabel;

		private ComboBox adapterComboBox;

		private Label adapterLabel;

		private ComboBox ssaoComboBox;

		private Button defaultButton;

		private Button identifyAdaptorButton;

		private ToolTip toolTip;

		private Label LODLabel;

		private Label envMapLabel;

		private ComboBox envMapComboBox;

		private ComboBox LODComboBox;

		private Label graphicsSettingsLabel;

		private Label commandlineLabel;

		private ComboBox facialQualityComboBox;

		private Label facialQualityLabel;

		private Label threadingLabel;

		private Label directXLabel;

		private ComboBox threadingComboBox;

		private ComboBox directXComboBox;

		private LANLauncher.Settings settings;

		private DXFuncs dxFuncs;

		public Options(LANLauncher.Settings _settings)
		{
			this.settings = _settings;
			this.InitializeComponent();
			base.Shown += new EventHandler(this.Options_Shown);
			this.settings.AddSetting("Adapter", "Default", this.adapterComboBox, this.adapterLabel);
			this.settings.AddSetting("Fullscreen", "YES", null, null);
			this.settings.AddSetting("Resolution", "1280x720x60", this.resolutionComboBox, this.resolutionLabel);
			this.settings.AddSetting("Antialiasing", "0", this.aaComboBox, this.aaLabel);
			this.settings.AddSetting("Anisotropic Filtering", "0", this.afComboBox, this.afLabel);
			this.settings.AddSetting("SSAO", "YES", this.ssaoComboBox, this.ssaoLabel);
			this.settings.AddSetting("Facial Quality", "Quality", this.facialQualityComboBox, this.facialQualityLabel);
			this.settings.AddSetting("Texture Detail", "Quality", this.textureComboBox, this.textureLabel);
			this.settings.AddSetting("Shadow Detail", "Balanced", this.shadowComboBox, this.shadowLabel);
			this.settings.AddSetting("Lighting Detail", "Quality", this.lightingComboBox, this.lightingLabel);
			this.settings.AddSetting("Environment Map Detail", "Balanced", this.envMapComboBox, this.envMapLabel);
			this.settings.AddSetting("LOD Quality", "Balanced", this.LODComboBox, this.LODLabel);
			this.settings.AddSetting("Interface Size", "Normal", null, null);
			this.settings.AddSetting("Threading", "Multi", this.threadingComboBox, this.threadingLabel);
			this.settings.AddSetting("Renderer", "DirectX 9", this.directXComboBox, this.directXLabel);
			this.settings.AddSetting("Command Line", "", this.commandlineTextbox, null);
			this.settings.LoadFromFile();
			if (Directory.Exists(string.Concat(Environment.SystemDirectory[0], ":\\Windows\\Microsoft.NET\\DirectX for Managed Code")))
			{
				this.dxFuncs = new DXFuncs();
			}
			else
			{
				MessageBox.Show(StringLocaliser.LocaliseString("UPDATEDX", false));
				Setting setting = _settings.GetSetting("Adapter");
				setting.Clear();
				setting.AddValue("Default");
				setting.DefaultValue = "Default";
				setting.AttachedControl.Enabled = false;
				Setting setting1 = _settings.GetSetting("Resolution");
				setting1.Clear();
				setting1.AddValue("1280x720x60");
				setting1.DefaultValue = "1280x720x60";
				setting1.AttachedControl.Enabled = false;
				Setting setting2 = _settings.GetSetting("Anisotropic Filtering");
				setting2.Clear();
				setting2.AddValue("0");
				setting2.DefaultValue = "0";
				setting2.AttachedControl.Enabled = false;
			}
			if (this.dxFuncs != null)
			{
				Setting setting3 = this.settings.GetSetting("Adapter");
				setting3.Clear();
				setting3.AddValue("Default");
				bool flag = false;
				if (this.dxFuncs.GetNumAdapters() <= 1)
				{
					this.identifyAdaptorButton.Visible = false;
					setting3.AttachedControl.Enabled = false;
				}
				else
				{
					flag = this.dxFuncs.AddAdapters(this.settings);
				}
				((ComboBox)setting3.AttachedControl).SelectedValueChanged += new EventHandler(this.AdapterControl_SelectedValueChanged);
				if (!flag)
				{
					this.dxFuncs.RefreshResolutionList(this.settings, 0);
				}
				setting3.DefaultValue = "Default";
			}
			Setting setting4 = this.settings.GetSetting("Fullscreen");
			setting4.Clear();
			if (false | setting4.AddValue("YES") | setting4.AddValue("NO"))
			{
				setting4.SetSelectedItem("YES");
			}
			setting4.SetDefaultValue("YES");
			Setting setting5 = this.settings.GetSetting("Antialiasing");
			setting5.Clear();
			if (false | setting5.AddValue("0") | setting5.AddValue("1") | setting5.AddValue("2") | setting5.AddValue("3"))
			{
				setting5.SetSelectedItem("0");
			}
			setting5.SetDefaultValue("0");
			if (this.dxFuncs != null)
			{
				this.dxFuncs.GetAnisotropicValues(this.settings);
			}
			Setting setting6 = this.settings.GetSetting("SSAO");
			setting6.Clear();
			if (false | setting6.AddValue("YES") | setting6.AddValue("NO"))
			{
				setting6.SetSelectedItem("YES");
			}
			setting6.SetDefaultValue("YES");
			Setting setting7 = this.settings.GetSetting("Facial Quality");
			setting7.Clear();
			if (false | setting7.AddValue("Performance") | setting7.AddValue("Quality"))
			{
				setting7.SetSelectedItem("Quality");
			}
			setting7.SetDefaultValue("Quality");
			Setting setting8 = this.settings.GetSetting("Texture Detail");
			setting8.Clear();
			if (false | setting8.AddValue("Performance") | setting8.AddValue("Quality"))
			{
				setting8.SetSelectedItem("Quality");
			}
			setting8.SetDefaultValue("Quality");
			Setting setting9 = this.settings.GetSetting("Shadow Detail");
			setting9.Clear();
			if (false | setting9.AddValue("Performance") | setting9.AddValue("Balanced") | setting9.AddValue("Quality"))
			{
				setting9.SetSelectedItem("Balanced");
			}
			setting9.SetDefaultValue("Balanced");
			Setting setting10 = this.settings.GetSetting("Lighting Detail");
			setting10.Clear();
			if (false | setting10.AddValue("Performance") | setting10.AddValue("Balanced") | setting10.AddValue("Quality"))
			{
				setting10.SetSelectedItem("Quality");
			}
			setting10.SetDefaultValue("Quality");
			Setting setting11 = this.settings.GetSetting("Environment Map Detail");
			setting11.Clear();
			if (false | setting11.AddValue("Performance") | setting11.AddValue("Balanced") | setting11.AddValue("Quality"))
			{
				setting11.SetSelectedItem("Balanced");
			}
			setting11.SetDefaultValue("Balanced");
			Setting setting12 = this.settings.GetSetting("LOD Quality");
			setting12.Clear();
			if (false | setting12.AddValue("Performance") | setting12.AddValue("Balanced") | setting12.AddValue("Quality"))
			{
				setting12.SetSelectedItem("Balanced");
			}
			setting12.SetDefaultValue("Balanced");
			Setting setting13 = this.settings.GetSetting("Threading");
			setting13.Clear();
			if (false | setting13.AddValue("Single") | setting13.AddValue("Multi"))
			{
				setting13.SetSelectedItem("Multi");
			}
			setting13.SetDefaultValue("Multi");
			Setting setting14 = this.settings.GetSetting("Renderer");
			setting14.Clear();
			bool flag1 = false;
			flag1 = flag1 | setting14.AddValue("DirectX 9");
			if (this.dxFuncs.SupportsDirectX11())
			{
				flag1 = flag1 | setting14.AddValue("DirectX 11");
			}
			if (!flag1)
			{
				setting14.SetSelectedItem("DirectX 9");
			}
			setting14.SetDefaultValue("DirectX 9");
			Setting setting15 = this.settings.GetSetting("Command Line");
			this.commandlineTextbox.Text = setting15.Value;
		}

		private void AdapterControl_SelectedValueChanged(object sender, EventArgs e)
		{
			ComboBox comboBox = null;
			try
			{
				comboBox = (ComboBox)sender;
			}
			catch
			{
				return;
			}
			string str = comboBox.SelectedItem.ToString();
			if (str != "Default")
			{
				this.dxFuncs.RefreshResolutionList(this.settings, str);
				return;
			}
			this.dxFuncs.RefreshResolutionList(this.settings, 0);
		}

		private void cancelButton_Click(object sender, EventArgs e)
		{
			foreach (Setting setting in this.settings.settings)
			{
				if (!this.FindControl(setting.AttachedControl))
				{
					continue;
				}
				setting.RevertValue();
			}
			base.Close();
		}

		private void defaultButton_Click(object sender, EventArgs e)
		{
			if (MessageBox.Show(StringLocaliser.LocaliseString("AREYOUSURE", false), StringLocaliser.LocaliseString("RESETTODEFAULT", false), MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.No)
			{
				return;
			}
			foreach (Setting setting in this.settings.settings)
			{
				if (!this.FindControl(setting.AttachedControl))
				{
					continue;
				}
				setting.ResetToDefault();
			}
		}

		protected override void Dispose(bool disposing)
		{
			if (disposing && this.components != null)
			{
				this.components.Dispose();
			}
			base.Dispose(disposing);
		}

		private bool FindControl(Control _parent, Control _control)
		{
			bool flag;
			if (_parent == _control)
			{
				return true;
			}
			IEnumerator enumerator = _parent.Controls.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					if (!this.FindControl((Control)enumerator.Current, _control))
					{
						continue;
					}
					flag = true;
					return flag;
				}
				return false;
			}
			finally
			{
				IDisposable disposable = enumerator as IDisposable;
				if (disposable != null)
				{
					disposable.Dispose();
				}
			}
			//return flag;
		}

		private bool FindControl(Control _control)
		{
			bool flag;
			IEnumerator enumerator = base.Controls.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					if (!this.FindControl((Control)enumerator.Current, _control))
					{
						continue;
					}
					flag = true;
					return flag;
				}
				return false;
			}
			finally
			{
				IDisposable disposable = enumerator as IDisposable;
				if (disposable != null)
				{
					disposable.Dispose();
				}
			}
			//return flag;
		}

		public string GetCommandLine()
		{
			return this.commandlineTextbox.Text;
		}

		private void identifyAdaptorButton_Click(object sender, EventArgs e)
		{
			Screen[] allScreens = Screen.AllScreens;
			Setting setting = this.settings.GetSetting("Adapter");
			Screen[] screenArray = allScreens;
			for (int i = 0; i < (int)screenArray.Length; i++)
			{
				Screen screen = screenArray[i];
				if (setting.WorkingValue.IndexOf(screen.DeviceName) > -1 || setting.WorkingValue == "Default" && screen.Primary)
				{
					IdentifierForm identifierForm = new IdentifierForm()
					{
						FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
					};
					identifierForm.idTextBox.Text = StringLocaliser.LocaliseString(setting.WorkingValue, true);
					identifierForm.StartPosition = FormStartPosition.Manual;
					identifierForm.Location = screen.Bounds.Location;
					int x = screen.Bounds.Location.X;
					Rectangle bounds = screen.Bounds;
					int width = x + bounds.Width / 2 - identifierForm.Width / 2;
					int y = screen.Bounds.Location.Y;
					Rectangle rectangle = screen.Bounds;
					identifierForm.Location = new Point(width, y + rectangle.Height / 2 - identifierForm.Height / 2);
					identifierForm.ShowDialog();
				}
			}
		}

		private void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(Options));
			this.LODComboBox = new ComboBox();
			this.envMapLabel = new Label();
			this.envMapComboBox = new ComboBox();
			this.LODLabel = new Label();
			this.identifyAdaptorButton = new Button();
			this.ssaoComboBox = new ComboBox();
			this.adapterComboBox = new ComboBox();
			this.adapterLabel = new Label();
			this.noteLabel = new Label();
			this.lightingComboBox = new ComboBox();
			this.shadowComboBox = new ComboBox();
			this.textureComboBox = new ComboBox();
			this.afComboBox = new ComboBox();
			this.aaComboBox = new ComboBox();
			this.resolutionComboBox = new ComboBox();
			this.lightingLabel = new Label();
			this.shadowLabel = new Label();
			this.textureLabel = new Label();
			this.ssaoLabel = new Label();
			this.afLabel = new Label();
			this.aaLabel = new Label();
			this.resolutionLabel = new Label();
			this.commandlineTextbox = new TextBox();
			this.okButton = new Button();
			this.cancelButton = new Button();
			this.defaultButton = new Button();
			this.toolTip = new ToolTip(this.components);
			this.graphicsSettingsLabel = new Label();
			this.commandlineLabel = new Label();
			this.facialQualityComboBox = new ComboBox();
			this.facialQualityLabel = new Label();
			this.threadingLabel = new Label();
			this.directXLabel = new Label();
			this.threadingComboBox = new ComboBox();
			this.directXComboBox = new ComboBox();
			base.SuspendLayout();
			this.LODComboBox.BackColor = Color.DimGray;
			this.LODComboBox.FlatStyle = FlatStyle.Flat;
			this.LODComboBox.FormattingEnabled = true;
			this.LODComboBox.Location = new Point(190, 405);
			this.LODComboBox.Name = "LODComboBox";
			this.LODComboBox.Size = new System.Drawing.Size(224, 21);
			this.LODComboBox.TabIndex = 26;
			this.envMapLabel.AutoSize = true;
			this.envMapLabel.ForeColor = Color.White;
			this.envMapLabel.Location = new Point(19, 375);
			this.envMapLabel.Name = "envMapLabel";
			this.envMapLabel.Size = new System.Drawing.Size(90, 13);
			this.envMapLabel.TabIndex = 25;
			this.envMapLabel.Text = "ENVMAPDETAIL";
			this.envMapComboBox.BackColor = Color.DimGray;
			this.envMapComboBox.FlatStyle = FlatStyle.Flat;
			this.envMapComboBox.FormattingEnabled = true;
			this.envMapComboBox.Location = new Point(190, 372);
			this.envMapComboBox.Name = "envMapComboBox";
			this.envMapComboBox.Size = new System.Drawing.Size(224, 21);
			this.envMapComboBox.TabIndex = 24;
			this.LODLabel.AutoSize = true;
			this.LODLabel.ForeColor = Color.White;
			this.LODLabel.Location = new Point(19, 408);
			this.LODLabel.Name = "LODLabel";
			this.LODLabel.Size = new System.Drawing.Size(62, 13);
			this.LODLabel.TabIndex = 22;
			this.LODLabel.Text = "LODLEVEL";
			this.identifyAdaptorButton.BackgroundImage = Resources.Button;
			this.identifyAdaptorButton.Cursor = Cursors.Help;
			this.identifyAdaptorButton.FlatAppearance.BorderColor = Color.Black;
			this.identifyAdaptorButton.FlatStyle = FlatStyle.Flat;
			this.identifyAdaptorButton.ForeColor = Color.White;
			this.identifyAdaptorButton.Location = new Point(161, 73);
			this.identifyAdaptorButton.Name = "identifyAdaptorButton";
			this.identifyAdaptorButton.Size = new System.Drawing.Size(23, 23);
			this.identifyAdaptorButton.TabIndex = 20;
			this.identifyAdaptorButton.Text = "?";
			this.identifyAdaptorButton.UseVisualStyleBackColor = true;
			this.identifyAdaptorButton.Click += new EventHandler(this.identifyAdaptorButton_Click);
			this.ssaoComboBox.BackColor = Color.DimGray;
			this.ssaoComboBox.FlatStyle = FlatStyle.Flat;
			this.ssaoComboBox.FormattingEnabled = true;
			this.ssaoComboBox.Location = new Point(190, 207);
			this.ssaoComboBox.Name = "ssaoComboBox";
			this.ssaoComboBox.Size = new System.Drawing.Size(225, 21);
			this.ssaoComboBox.TabIndex = 17;
			this.adapterComboBox.BackColor = Color.DimGray;
			this.adapterComboBox.FlatStyle = FlatStyle.Flat;
			this.adapterComboBox.FormattingEnabled = true;
			this.adapterComboBox.Location = new Point(190, 75);
			this.adapterComboBox.Name = "adapterComboBox";
			this.adapterComboBox.Size = new System.Drawing.Size(225, 21);
			this.adapterComboBox.TabIndex = 16;
			this.adapterLabel.AutoSize = true;
			this.adapterLabel.ForeColor = Color.White;
			this.adapterLabel.Location = new Point(19, 78);
			this.adapterLabel.Name = "adapterLabel";
			this.adapterLabel.Size = new System.Drawing.Size(58, 13);
			this.adapterLabel.TabIndex = 15;
			this.adapterLabel.Text = "ADAPTER";
			this.noteLabel.AutoSize = true;
			this.noteLabel.ForeColor = Color.White;
			this.noteLabel.Location = new Point(19, 42);
			this.noteLabel.Name = "noteLabel";
			this.noteLabel.Size = new System.Drawing.Size(43, 13);
			this.noteLabel.TabIndex = 14;
			this.noteLabel.Text = "NOTE1";
			this.lightingComboBox.BackColor = Color.DimGray;
			this.lightingComboBox.FlatStyle = FlatStyle.Flat;
			this.lightingComboBox.FormattingEnabled = true;
			this.lightingComboBox.Location = new Point(190, 339);
			this.lightingComboBox.Name = "lightingComboBox";
			this.lightingComboBox.Size = new System.Drawing.Size(225, 21);
			this.lightingComboBox.TabIndex = 13;
			this.shadowComboBox.BackColor = Color.DimGray;
			this.shadowComboBox.FlatStyle = FlatStyle.Flat;
			this.shadowComboBox.FormattingEnabled = true;
			this.shadowComboBox.Location = new Point(190, 306);
			this.shadowComboBox.Name = "shadowComboBox";
			this.shadowComboBox.Size = new System.Drawing.Size(225, 21);
			this.shadowComboBox.TabIndex = 12;
			this.textureComboBox.BackColor = Color.DimGray;
			this.textureComboBox.FlatStyle = FlatStyle.Flat;
			this.textureComboBox.FormattingEnabled = true;
			this.textureComboBox.Location = new Point(190, 273);
			this.textureComboBox.Name = "textureComboBox";
			this.textureComboBox.Size = new System.Drawing.Size(225, 21);
			this.textureComboBox.TabIndex = 10;
			this.afComboBox.BackColor = Color.DimGray;
			this.afComboBox.FlatStyle = FlatStyle.Flat;
			this.afComboBox.FormattingEnabled = true;
			this.afComboBox.Location = new Point(190, 174);
			this.afComboBox.Name = "afComboBox";
			this.afComboBox.Size = new System.Drawing.Size(225, 21);
			this.afComboBox.TabIndex = 9;
			this.aaComboBox.BackColor = Color.DimGray;
			this.aaComboBox.FlatStyle = FlatStyle.Flat;
			this.aaComboBox.FormattingEnabled = true;
			this.aaComboBox.Location = new Point(190, 141);
			this.aaComboBox.Name = "aaComboBox";
			this.aaComboBox.Size = new System.Drawing.Size(225, 21);
			this.aaComboBox.TabIndex = 8;
			this.resolutionComboBox.BackColor = Color.DimGray;
			this.resolutionComboBox.FlatStyle = FlatStyle.Flat;
			this.resolutionComboBox.FormattingEnabled = true;
			this.resolutionComboBox.Location = new Point(190, 108);
			this.resolutionComboBox.Name = "resolutionComboBox";
			this.resolutionComboBox.Size = new System.Drawing.Size(225, 21);
			this.resolutionComboBox.TabIndex = 7;
			this.lightingLabel.AutoSize = true;
			this.lightingLabel.ForeColor = Color.White;
			this.lightingLabel.Location = new Point(19, 342);
			this.lightingLabel.Name = "lightingLabel";
			this.lightingLabel.Size = new System.Drawing.Size(96, 13);
			this.lightingLabel.TabIndex = 6;
			this.lightingLabel.Text = "LIGHTINGDETAIL";
			this.shadowLabel.AutoSize = true;
			this.shadowLabel.ForeColor = Color.White;
			this.shadowLabel.Location = new Point(19, 309);
			this.shadowLabel.Name = "shadowLabel";
			this.shadowLabel.Size = new System.Drawing.Size(94, 13);
			this.shadowLabel.TabIndex = 5;
			this.shadowLabel.Text = "SHADOWDETAIL";
			this.textureLabel.AutoSize = true;
			this.textureLabel.ForeColor = Color.White;
			this.textureLabel.Location = new Point(19, 276);
			this.textureLabel.Name = "textureLabel";
			this.textureLabel.Size = new System.Drawing.Size(96, 13);
			this.textureLabel.TabIndex = 4;
			this.textureLabel.Text = "TEXTUREDETAIL";
			this.ssaoLabel.AutoSize = true;
			this.ssaoLabel.ForeColor = Color.White;
			this.ssaoLabel.Location = new Point(19, 210);
			this.ssaoLabel.Name = "ssaoLabel";
			this.ssaoLabel.Size = new System.Drawing.Size(117, 13);
			this.ssaoLabel.TabIndex = 3;
			this.ssaoLabel.Text = "AMBIENTOCCLUSION";
			this.afLabel.AutoSize = true;
			this.afLabel.ForeColor = Color.White;
			this.afLabel.Location = new Point(19, 177);
			this.afLabel.Name = "afLabel";
			this.afLabel.Size = new System.Drawing.Size(80, 13);
			this.afLabel.TabIndex = 2;
			this.afLabel.Text = "ANISOTROPIC";
			this.aaLabel.AutoSize = true;
			this.aaLabel.ForeColor = Color.White;
			this.aaLabel.Location = new Point(19, 144);
			this.aaLabel.Name = "aaLabel";
			this.aaLabel.Size = new System.Drawing.Size(81, 13);
			this.aaLabel.TabIndex = 1;
			this.aaLabel.Text = "ANTIALIASING";
			this.resolutionLabel.AutoSize = true;
			this.resolutionLabel.ForeColor = Color.White;
			this.resolutionLabel.Location = new Point(19, 111);
			this.resolutionLabel.Name = "resolutionLabel";
			this.resolutionLabel.Size = new System.Drawing.Size(77, 13);
			this.resolutionLabel.TabIndex = 0;
			this.resolutionLabel.Text = "RESOLUTION";
			this.commandlineTextbox.BackColor = Color.DimGray;
			this.commandlineTextbox.BorderStyle = BorderStyle.None;
			this.commandlineTextbox.Location = new Point(17, 530);
			this.commandlineTextbox.Name = "commandlineTextbox";
			this.commandlineTextbox.Size = new System.Drawing.Size(394, 13);
			this.commandlineTextbox.TabIndex = 0;
			this.okButton.BackgroundImage = (Image)componentResourceManager.GetObject("okButton.BackgroundImage");
			this.okButton.FlatAppearance.BorderColor = Color.Black;
			this.okButton.FlatStyle = FlatStyle.Flat;
			this.okButton.ForeColor = Color.White;
			this.okButton.Location = new Point(48, 561);
			this.okButton.Name = "okButton";
			this.okButton.Size = new System.Drawing.Size(98, 23);
			this.okButton.TabIndex = 2;
			this.okButton.Text = "OK";
			this.okButton.UseVisualStyleBackColor = true;
			this.okButton.Click += new EventHandler(this.okButton_Click);
			this.cancelButton.BackgroundImage = (Image)componentResourceManager.GetObject("cancelButton.BackgroundImage");
			this.cancelButton.FlatAppearance.BorderColor = Color.Black;
			this.cancelButton.FlatStyle = FlatStyle.Flat;
			this.cancelButton.ForeColor = Color.White;
			this.cancelButton.Location = new Point(161, 561);
			this.cancelButton.Name = "cancelButton";
			this.cancelButton.Size = new System.Drawing.Size(98, 23);
			this.cancelButton.TabIndex = 3;
			this.cancelButton.Text = "CANCEL";
			this.cancelButton.UseVisualStyleBackColor = true;
			this.cancelButton.Click += new EventHandler(this.cancelButton_Click);
			this.defaultButton.BackgroundImage = (Image)componentResourceManager.GetObject("defaultButton.BackgroundImage");
			this.defaultButton.FlatAppearance.BorderColor = Color.Black;
			this.defaultButton.FlatStyle = FlatStyle.Flat;
			this.defaultButton.ForeColor = Color.White;
			this.defaultButton.Location = new Point(274, 561);
			this.defaultButton.Name = "defaultButton";
			this.defaultButton.Size = new System.Drawing.Size(98, 23);
			this.defaultButton.TabIndex = 4;
			this.defaultButton.Text = "DEFAULT";
			this.defaultButton.UseVisualStyleBackColor = true;
			this.defaultButton.Click += new EventHandler(this.defaultButton_Click);
			this.toolTip.IsBalloon = true;
			this.toolTip.Popup += new PopupEventHandler(this.toolTip_Popup);
			this.graphicsSettingsLabel.AutoSize = true;
			this.graphicsSettingsLabel.ForeColor = Color.White;
			this.graphicsSettingsLabel.Location = new Point(19, 13);
			this.graphicsSettingsLabel.Name = "graphicsSettingsLabel";
			this.graphicsSettingsLabel.Size = new System.Drawing.Size(116, 13);
			this.graphicsSettingsLabel.TabIndex = 27;
			this.graphicsSettingsLabel.Text = "GRAPHICSSETTINGS";
			this.commandlineLabel.AutoSize = true;
			this.commandlineLabel.ForeColor = Color.White;
			this.commandlineLabel.Location = new Point(14, 510);
			this.commandlineLabel.Name = "commandlineLabel";
			this.commandlineLabel.Size = new System.Drawing.Size(87, 13);
			this.commandlineLabel.TabIndex = 28;
			this.commandlineLabel.Text = "COMMANDLINE";
			this.facialQualityComboBox.BackColor = Color.DimGray;
			this.facialQualityComboBox.FlatStyle = FlatStyle.Flat;
			this.facialQualityComboBox.FormattingEnabled = true;
			this.facialQualityComboBox.Location = new Point(190, 240);
			this.facialQualityComboBox.Name = "facialQualityComboBox";
			this.facialQualityComboBox.Size = new System.Drawing.Size(225, 21);
			this.facialQualityComboBox.TabIndex = 29;
			this.facialQualityLabel.AutoSize = true;
			this.facialQualityLabel.BackColor = Color.Black;
			this.facialQualityLabel.ForeColor = Color.White;
			this.facialQualityLabel.Location = new Point(19, 243);
			this.facialQualityLabel.Name = "facialQualityLabel";
			this.facialQualityLabel.Size = new System.Drawing.Size(89, 13);
			this.facialQualityLabel.TabIndex = 30;
			this.facialQualityLabel.Text = "FACIALQUALITY";
			this.threadingLabel.AutoSize = true;
			this.threadingLabel.ForeColor = Color.White;
			this.threadingLabel.Location = new Point(19, 441);
			this.threadingLabel.Name = "threadingLabel";
			this.threadingLabel.Size = new System.Drawing.Size(71, 13);
			this.threadingLabel.TabIndex = 31;
			this.threadingLabel.Text = "THREADING";
			this.directXLabel.AutoSize = true;
			this.directXLabel.ForeColor = Color.White;
			this.directXLabel.Location = new Point(19, 474);
			this.directXLabel.Name = "directXLabel";
			this.directXLabel.Size = new System.Drawing.Size(54, 13);
			this.directXLabel.TabIndex = 32;
			this.directXLabel.Text = "DIRECTX";
			this.threadingComboBox.BackColor = Color.DimGray;
			this.threadingComboBox.FlatStyle = FlatStyle.Flat;
			this.threadingComboBox.FormattingEnabled = true;
			this.threadingComboBox.Location = new Point(190, 438);
			this.threadingComboBox.Name = "threadingComboBox";
			this.threadingComboBox.Size = new System.Drawing.Size(225, 21);
			this.threadingComboBox.TabIndex = 33;
			this.directXComboBox.BackColor = Color.DimGray;
			this.directXComboBox.FlatStyle = FlatStyle.Flat;
			this.directXComboBox.FormattingEnabled = true;
			this.directXComboBox.Location = new Point(190, 471);
			this.directXComboBox.Name = "directXComboBox";
			this.directXComboBox.Size = new System.Drawing.Size(225, 21);
			this.directXComboBox.TabIndex = 34;
			base.AutoScaleDimensions = new SizeF(6f, 13f);
			base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			this.BackColor = Color.Black;
			base.ClientSize = new System.Drawing.Size(431, 596);
			base.ControlBox = false;
			base.Controls.Add(this.directXComboBox);
			base.Controls.Add(this.threadingComboBox);
			base.Controls.Add(this.directXLabel);
			base.Controls.Add(this.threadingLabel);
			base.Controls.Add(this.facialQualityLabel);
			base.Controls.Add(this.facialQualityComboBox);
			base.Controls.Add(this.commandlineLabel);
			base.Controls.Add(this.commandlineTextbox);
			base.Controls.Add(this.graphicsSettingsLabel);
			base.Controls.Add(this.LODComboBox);
			base.Controls.Add(this.defaultButton);
			base.Controls.Add(this.envMapLabel);
			base.Controls.Add(this.cancelButton);
			base.Controls.Add(this.envMapComboBox);
			base.Controls.Add(this.okButton);
			base.Controls.Add(this.LODLabel);
			base.Controls.Add(this.identifyAdaptorButton);
			base.Controls.Add(this.adapterComboBox);
			base.Controls.Add(this.resolutionLabel);
			base.Controls.Add(this.ssaoComboBox);
			base.Controls.Add(this.aaLabel);
			base.Controls.Add(this.afLabel);
			base.Controls.Add(this.adapterLabel);
			base.Controls.Add(this.ssaoLabel);
			base.Controls.Add(this.noteLabel);
			base.Controls.Add(this.textureLabel);
			base.Controls.Add(this.lightingComboBox);
			base.Controls.Add(this.shadowLabel);
			base.Controls.Add(this.shadowComboBox);
			base.Controls.Add(this.lightingLabel);
			base.Controls.Add(this.textureComboBox);
			base.Controls.Add(this.resolutionComboBox);
			base.Controls.Add(this.afComboBox);
			base.Controls.Add(this.aaComboBox);
			base.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
			base.MaximizeBox = false;
			base.MinimizeBox = false;
			base.Name = "Options";
			base.ShowIcon = false;
			base.ShowInTaskbar = false;
			base.StartPosition = FormStartPosition.CenterParent;
			this.Text = "Options";
			base.ResumeLayout(false);
			base.PerformLayout();
		}

		private void LocaliseControl(Control _control)
		{
			StringLocaliser.LocaliseString(string.Concat(_control.Name, "_TT"), false);
			if (_control is TextBox)
			{
				return;
			}
			if (_control is ComboBox)
			{
				ComboBox comboBox = (ComboBox)_control;
				if (comboBox.Items.Count < 2)
				{
					comboBox.Enabled = false;
				}
				return;
			}
			_control.Text = StringLocaliser.LocaliseString(_control.Name, false);
			foreach (Control control in _control.Controls)
			{
				this.LocaliseControl(control);
			}
		}

		private void okButton_Click(object sender, EventArgs e)
		{
			foreach (Setting setting in this.settings.settings)
			{
				if (!this.FindControl(setting.AttachedControl))
				{
					continue;
				}
				setting.UpdateValue();
			}
			this.settings.SetSettingsNeedSaved();
			base.Close();
		}

		private void Options_Shown(object sender, EventArgs e)
		{
			this.LocaliseControl((Form)sender);
			this.settings.LocaliseSettings();
		}

		private void toolTip_Popup(object sender, PopupEventArgs e)
		{
		}
	}
}